extends layout

block content

  #mountNode

  script.
    setInterval(function () {
      $.get('/api/db/physical?type=#{type}', function (res, status) {
        $('#mountNode').find('div').remove()
        console.log(res)
        data = res.data
        if (res.errno === 0) {
          const chart = new G2.Chart({
            container: 'mountNode',
            forceFit: true,
            height: window.innerHeight
          });
          chart.source(data);
          chart.scale('value', {
            min: 0
          });
          chart.scale('time', {
            range: [0, 1]
          });
          chart.tooltip({
            crosshairs: {
              type: 'line'
            }
          });
          chart.line().position('time*value');
          chart.point().position('time*value').size(4).shape('circle').style({
            stroke: '#fff',
            lineWidth: 1
          });
          chart.render();
        } else {
          alert(res.msg)
        }
      })
    }, 2000)
